public class Demo07 {
    public static void main(String[] args) {
        int num = 90;
        switch (num) {
            case 10:
                System.out.println("num = 10");
                break;
            case 20:
                System.out.println("num = 20");
                break;
            default:
                System.out.println(num);
                break;
        }

        int num = 50;
        switch (num) {
            case 30:
            case 40:
                System.out.println("num = 30或者num = 40");
                break;
            default:
                break;
        }

        String name = "李四";
        switch (name) {
            case "张三" -> System.out.println("张三");
            case "李四" -> System.out.println("李四");
            default -> System.out.println("default");
        }

        String fruit = "apple";
        int opt;
        switch (fruit) {
            case "apple" -> opt = 1;
            case "pear", "mango" -> opt = 2;
            default -> opt = 0;
        }
        System.out.println(opt);
    }
}
